package kosta.controller;

import java.sql.SQLException;

import javax.annotation.Resource;

import kosta.model.MemberService;
import kosta.model.MemberVO;
import kosta.model.StudentVO;
import kosta.model.TeacherVO;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class MemberController {
	@Resource(name="memberServiceImpl")
	private MemberService memberService;
	
	@RequestMapping("/registerMember.do")
	private ModelAndView castingMember(TeacherVO tvo) throws SQLException {
		System.out.println(tvo+"castingMember ");
		registerMember(tvo);
		return new ModelAndView("register_result","mvo",tvo);
	}
	private void castingMember(StudentVO svo) throws SQLException {
		registerMember(svo);
	}
	
	public void registerMember(MemberVO mvo) throws SQLException{	
		System.out.println(mvo+"1");
		memberService.registerMember(mvo);
		System.out.println(mvo+"2");
		
	}

	@RequestMapping("/showMember.do")
	public ModelAndView showMember(MemberVO mvo) throws SQLException{
		MemberVO  rmvo=memberService.showMember(mvo);
		return new ModelAndView("result","mvo",rmvo);
	}
}
